package view;

import model.Circle;
import model.Shape;
import model.ShapeType;
import model.Square;
import appmodel.ControllerEvent;
import appmodel.ControllerEventType;
import appmodel.ShapeControllerEvent;

public class ControllerEventParser {
	private Shape shape;
	private ShapeType shapeType;
	private ControllerEventType eventType;

	public ControllerEventParser(ControllerEvent event) {
		super();
		eventType = event.getType();
		switch (eventType) {
		case ADD_SHAPE:
		case EDIT_SHAPE:
		case REMOVE_SHAPE:
			shape = ((ShapeControllerEvent) event).getShape();
			shapeType = ((ShapeControllerEvent) event).getShape().getShapeType();
			break;
		case REFRESH:
			break;
		}
	}

	public void processEvent() {
		switch (eventType) {
		case ADD_SHAPE:
			if (shapeType == ShapeType.CIRCLE) {
				addShape((Circle) shape);
			}
			if (shapeType == ShapeType.SQUARE) {
				addShape((Square) shape);
			}
			break;
		case REMOVE_SHAPE:
			if (shapeType == ShapeType.CIRCLE) {
				removeShape((Circle) shape);
			}
			if (shapeType == ShapeType.SQUARE) {
				removeShape((Square) shape);
			}
			break;
		case EDIT_SHAPE:
			if (shapeType == ShapeType.CIRCLE) {
				editShape((Circle) shape);
			}
			if (shapeType == ShapeType.SQUARE) {
				editShape((Square) shape);
			}
			break;
		case REFRESH:
			refresh();
			break;
		}
	}

	public void refresh() {

	}

	public void editShape(Circle shape2) {

	}

	public void editShape(Square shape2) {

	}

	public void removeShape(Square s) {

	}

	public void removeShape(Circle c) {

	}

	public void addShape(Square s) {

	}

	public void addShape(Circle c) {

	}
}